package cn.yy.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bonus entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "bonus", catalog = "phoneerp")
public class Bonus implements java.io.Serializable {

	// Fields

	private Integer bonusId;
	private Year year;
	private Client client;
	private Provider provider;
	private Month month;
	private Double bonus;
	private Integer isClientBonus;
	private Set<Recipt> recipts = new HashSet<Recipt>(0);
	private Set<Paybill> paybills = new HashSet<Paybill>(0);

	// Constructors

	/** default constructor */
	public Bonus() {
	}

	/** minimal constructor */
	public Bonus(Year year, Month month, Double bonus, Integer isClientBonus) {
		this.year = year;
		this.month = month;
		this.bonus = bonus;
		this.isClientBonus = isClientBonus;
	}

	/** full constructor */
	public Bonus(Year year, Client client, Provider provider, Month month,
			Double bonus, Integer isClientBonus, Set<Recipt> recipts,
			Set<Paybill> paybills) {
		this.year = year;
		this.client = client;
		this.provider = provider;
		this.month = month;
		this.bonus = bonus;
		this.isClientBonus = isClientBonus;
		this.recipts = recipts;
		this.paybills = paybills;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "bonusId", unique = true, nullable = false)
	public Integer getBonusId() {
		return this.bonusId;
	}

	public void setBonusId(Integer bonusId) {
		this.bonusId = bonusId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "yearId", nullable = false)
	public Year getYear() {
		return this.year;
	}

	public void setYear(Year year) {
		this.year = year;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "clientId")
	public Client getClient() {
		return this.client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "providerId")
	public Provider getProvider() {
		return this.provider;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "monthId", nullable = false)
	public Month getMonth() {
		return this.month;
	}

	public void setMonth(Month month) {
		this.month = month;
	}

	@Column(name = "bonus", nullable = false, precision = 22, scale = 0)
	public Double getBonus() {
		return this.bonus;
	}

	public void setBonus(Double bonus) {
		this.bonus = bonus;
	}

	@Column(name = "isClientBonus", nullable = false)
	public Integer getIsClientBonus() {
		return this.isClientBonus;
	}

	public void setIsClientBonus(Integer isClientBonus) {
		this.isClientBonus = isClientBonus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bonus")
	public Set<Recipt> getRecipts() {
		return this.recipts;
	}

	public void setRecipts(Set<Recipt> recipts) {
		this.recipts = recipts;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "bonus")
	public Set<Paybill> getPaybills() {
		return this.paybills;
	}

	public void setPaybills(Set<Paybill> paybills) {
		this.paybills = paybills;
	}

}